package maxProfit

import "fmt"

func dpWork(prices []int) int {
	cur := 0
	res := 0
	for i := 1; i < len(prices); i++ {
		cur += prices[i] - prices[i-1]
		if cur < 0 {
			cur = 0
		}
		res = max(res, cur)
	}
	fmt.Println(res)
	return res
}
